package org.xjtu.weteam.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import org.xjtu.weteam.model.domain.User;
import org.xjtu.weteam.model.domain.UserTask;

import java.util.List;

/**
 * @author Kevin
 */

@Mapper
public interface UserTaskMapper extends BaseMapper<UserTask> {
    @Insert("insert into user_task (user_id, task_id) VALUES (#{userId}, #{taskId})")
    void insertRelationship(UserTask userTask);

    List<String> searchUserProfilesByTaskId(@Param("taskId") Integer taskId);
    List<User> getTaskUsers(@Param("taskId") Integer taskId);
    @Delete("delete from user_task where task_id = #{taskId} and user_id = #{userId}")
    void deleteRelationship(@Param("taskId") Integer taskId,@Param("userId") Integer userId);
}
